#ifndef CODER_H
#define CODER_H

class Coder
{

public:
	void SetBuf( char *cpBuf );
	int SetHeader( short sType );
	void GetHeader( short *sBodySize, short *sType );

	void PutChar( char cData );
	void GetChar( char *cpData );
	void PutShort( short sData );
	void GetShort( short *sData );
	void PutInt( int iData );
	void GetInt( int *iData );
	void PutText( const char *cpData, int iSize );
	void GetText( char *cpData, int iSize );

	char* Current() { return cpCoderEnd; }
	void  Advanced(int step) { cpCoderEnd += step; }


private:
	char*					cpCoderBegin;
	char*					cpCoderEnd;

};


#define HEADER_TOTAL_SIZE 2
#define HEADER_TYPE_SIZE 2
#define HEADERSIZE HEADER_TOTAL_SIZE + HEADER_TYPE_SIZE


#endif